#include<bits/stdc++.h>
using namespace std;
const int N=8010;
long long n,q,b[N],a[N];
void add(long long op){
	for(long long i=1;i<=n;i++)
		b[i]=a[i];
	for(long long i=1;i<=n;i++){
		for(long long j=i;j>=2;j--){
			if(b[j]<b[j-1]){
				swap(b[j],b[j-1]);
				if(j==op)
					op=j-1;
				else if(j-1==op)
					op=j;
			}
		}
	}
	cout<<op<<endl;
}
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%lld%lld",&n,&q);
	long long x,y;
	for(long long i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(long long i=1;i<=q;i++){
		cin>>x;
		if(x==1){
			cin>>x>>y;
			a[x]=y;
		}else{
			cin>>y;
			add(y);
		}
	}
	return 0;
 } 
 
 /*
 
 
			for(int i=1;i<=n;i++)
				cout<<b[i]<<" ";
			cout<<endl;
 
 
 
//				cout<<j<<" "<<j-1<<" "<<op<<endl;
 
 
 
 
 */ 
